<template>
  <HomePannel ref="target" title="人气推荐" subTitle="人气爆款 不容错过">
    <template #right>
      <XtxMore path="/"></XtxMore>
    </template>
    <HomeCommonList :newData="newData"></HomeCommonList>
  </HomePannel>
</template>

<script>
import HomeCommonList from './home-common-list.vue'
import HomePannel from './home-panel.vue'
import { findHot } from '@/api/home'
import { ref } from 'vue'
import { useObserve } from '@/hook'
export default {
  components: {
    HomePannel,
    HomeCommonList
  },
  setup () {
    const newData = ref([])
    async function getHot () {
      const { result } = await findHot()
      console.log('人气', result)
      newData.value = result
    }
    // onMounted(() => {
    //   getHot()
    // })
    // 监控
    const { target } = useObserve(getHot)
    return { newData, target }
  }
}
</script>
